package com.fanco.learn_datastruct_leetcode.designpattern.responsebilitychain;

import java.util.Arrays;

/**
 * @author qiaowang 2022/2/24
 * 描述
 */
public class Client {
    public static void main(String[] args) {

        PurchaseRequest purchaseRequest = new PurchaseRequest(1, 78000, 12);

        DepartmentApprover departmentApprover = new DepartmentApprover("张主任");

        CollegeApprover collegeApprover = new CollegeApprover("李院长");

        ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("钱副校长");

        SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("王校长");

        // 需要将各个审批级别的下一个设置好（处理人构成环形）
        departmentApprover.setApprover(collegeApprover);
        collegeApprover.setApprover(viceSchoolMasterApprover);
        viceSchoolMasterApprover.setApprover(schoolMasterApprover);
        schoolMasterApprover.setApprover(departmentApprover);

        departmentApprover.processRequest(purchaseRequest);

    }
}
